
import 'osc_author.dart';
import 'osc_statistics.dart';

class OscPostEntity {
	int newsId;
	OscAuthor author;
	OscPostExtra extra;
	String href;
	int id;
	String body;
	String title;
	int type;
	String pubDate;
	OscStatistics statistics;
	List<String> tags;

	OscPostEntity({this.newsId, this.author, this.extra, this.href, this.id, this.body, this.title, this.type, this.pubDate, this.statistics, this.tags});

	OscPostEntity.fromJson(Map<String, dynamic> json) {
		newsId = json['newsId'];
		author = json['author'] != null ? new OscAuthor.fromJson(json['author']) : null;
		extra = json['extra'] != null ? new OscPostExtra.fromJson(json['extra']) : null;
		href = json['href'];
		id = json['id'];
		body = json['body'];
		title = json['title'];
		type = json['type'];
		pubDate = json['pubDate'];
		statistics = json['statistics'] != null ? new OscStatistics.fromJson(json['statistics']) : null;
		tags = json['tags']?.cast<String>();
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['newsId'] = this.newsId;
		if (this.author != null) {
      data['author'] = this.author.toJson();
    }
		if (this.extra != null) {
      data['extra'] = this.extra.toJson();
    }
		data['href'] = this.href;
		data['id'] = this.id;
		data['body'] = this.body;
		data['title'] = this.title;
		data['type'] = this.type;
		data['pubDate'] = this.pubDate;
		if (this.statistics != null) {
      data['statistics'] = this.statistics.toJson();
    }
		data['tags'] = this.tags;
		return data;
	}
}

class OscPostExtra {
	bool isPrivate;

	OscPostExtra({this.isPrivate});

	OscPostExtra.fromJson(Map<String, dynamic> json) {
		isPrivate = json['isPrivate'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['isPrivate'] = this.isPrivate;
		return data;
	}
}